<!--
  @author heguanghua
  @since 2019/06/12 11:57
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<body>


<div class="layui-fluid">

    <blockquote class="layui-crumb">
        渠道管理>
        <a lay-href="/channel/list.action">渠道管理</a>>
        <a th:href="'/channel/detail.action?channelId='+${obj.channelId}">[[${obj.name}]]</a>>
        <zmn th:text="押金管理">押金管理</zmn>
    </blockquote>

    <div class="layui-card">

        <div th:replace="channel/_tab::tab"></div>

        <div class="layui-card-body">
            <div class="layui-form-item">
                <span style="font-size: 18px; margin-left: 20px;">当前押金余额：</span><span style="font-size: 20px; font-weight: bold; color: #009E94;" th:text="${deposit == null || deposit.balance == 0 ? 0 : #numberUtil.convertMoneyToYuan(deposit.balance)}"></span><span style="font-size: 20px; font-weight: bold; color: #009E94;">元</span>
            </div>
            <input type="hidden" id="channelId" name="channelId" th:value="${obj.channelId}"/>
            <table class="layui-hide" id="zmn-table" lay-filter="zmn-table">
                <thead>
                <tr>
                    <th lay-data="{field:'amount', width:250, unresize:true, align:'center'}">金额(元)</th>
                    <th lay-data="{field:'createTime', unresize:true, align:'center'}">类型</th>
                    <th lay-data="{field:'balance', width:250, unresize:true, align:'center'}">押金余额</th>
                    <th lay-data="{field:'remark', width:500, unresize:true, align:'center'}">备注说明</th>
                    <th lay-data="{field:'creater', unresize:true, align:'center'}">最近修改人/时间</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="log:${depositLogs}">
                    <td th:text="${#numberUtil.convertMoneyToYuan(log.amount)}"></td>
                    <td><span th:text="${log.type == 1 ? '收款':(log.type == 2 ? '退款':'扣款') }"
                              th:style="|${'color: '+ (log.type == 1? 'block':(log.type == 2 ? '#FF5722' : '#FF0000'))}|"/></td>
                    <td th:text="${#numberUtil.convertMoneyToYuan(log.balance)}"></td>
                    <td th:text="${log.remark}"></td>
                    <td th:text="${log.creater}+'/'+${#dates.format(log.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                </tr>
                </tbody>
            </table>
            <script type="text/html" id="zmn-table-tool">
                <div class="layui-btn-container">
                    <div class="layui-btn-group"
                         th:if="${#authPermit.checkPermit('/channel/deposit/addEdit.action') || (#authPermit.checkPermit('/channel/add.action') && addFlag == '1')}">
                        <button class="layui-btn layui-btn-sm" lay-event="in">收款</button>
                        <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="out">退款</button>
                        <button class="layui-btn layui-btn-sm layui-btn-danger" style="background-color: red; "
                                lay-event="deduct">扣款
                        </button>
                    </div>
                </div>
            </script>
        </div>
    </div>

</div>
</body>
</html>

<script id="inOutHtml" type="text/html">
    <form method="POST" action="" class="layui-form" lay-filter="zmn-form">
        <input type="hidden" name="type" value="{{d.type}}"/>
        <div class="layui-form-item"></div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">金额：</label>
            <div class="layui-input-inline" style="width:100px">
                <input type="text" name="amount" placeholder="金额" lay-verify="required|number|amount"
                       lay-verType="tips" autocomplete="off" class="layui-input" maxlength="9"/>
            </div>
            <span class="layui-form-label" style="width: auto; color: #9F9F9F;">元&nbsp;&nbsp;输入后请确认金额大小</span>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注说明：</label>
            <div class="layui-input-inline" style="width:300px">
                <textarea name="remark" class="layui-textarea" placeholder="备注说明" lay-verify="" lay-verType="tips" maxlength="200"></textarea>
            </div>
        </div>
        <div class="layui-form-item submit">
            <div style="text-align: center">
                <button class="layui-btn" lay-submit lay-filter="zmn-form-submit">提交</button>
                <a class="layui-btn layui-btn-primary" onclick="layer.close(childIndex);">取消</a>
            </div>
        </div>
    </form>
</script>

<script type="text/javascript" th:inline="javascript">

    var json = {
        addFlag: [[${addFlag}]]
    };

    let childIndex;
    layui.config({
        base: "/static/lay/",
        version: 201908231434
    }).extend({
        index: "lib/index",
        channel_deposit: "channel/zmn.plat.channel.deposit",
    }).use(['index', 'channel_deposit']);

</script>